package com.ruoyi.common.satoken.seller.config;


import com.catering.common.seller.aop.SellerIgnoreAspect;
import com.ruoyi.common.satoken.seller.filter.SellerFilter;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;


/**
 * 店铺自动配置
 *
 * @author 来得及
 * @date 2023/03/20
 */
@AutoConfiguration
@EnableConfigurationProperties(SellerProperties.class)
public class SellerAutoConfiguration {

    /**
     * 店铺安全网络过滤器
     *
     * @return {@link FilterRegistrationBean}<{@link SellerFilter}>
     */
    @Bean
    public FilterRegistrationBean<SellerFilter> sellerSecurityWebFilter() {
        FilterRegistrationBean<SellerFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new SellerFilter());
        registrationBean.setOrder(-99);
        return registrationBean;
    }

    /**
     * 店铺忽略切面
     *
     * @return {@link SellerIgnoreAspect}
     */
    @Bean
    public SellerIgnoreAspect sellerIgnoreAspect() {
        return new SellerIgnoreAspect();
    }

}
